/*
*   Copyright (c) 2011 CPE 453-UAH03 <https://code.google.com/p/uah03-qtaprs/>
*   This file is part of qt-aprs.
*
*   qt-aprs is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*
*   qt-aprs is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <qfile.h>
#include <QTextStream>
#include <QTcpSocket>
#include "aprs_parser.h"
#include "mapdialog.h"
#include <connectioninterface.h>
#include <connectionselector.h>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();


signals:
    void CenterTheMap(QString, QString, QString);
    void UpdateMapCenter(QString, QString);

private:
    Ui::MainWindow *ui;
    QTextStream *stream;
    MapDialog *d;
    QStringList SelectedMaps;
    bool connectionStatus;
    QTcpSocket *socket;
    QString icon;
    QString positionReport;
    APRSParser *aprs_parser;
    QString intToString(int num, int size);
    ConnectionInterface* connections;
    ConnectionSelector* _CS;
    void autoSave();
    void autoLoad();

private slots:
    void ShowMaps();
    void SaveSettings();
    void LoadSettings();
    void DBConfig();
    void ParseData();
    void ParseData(QString data);
    void disconnect();
    void onClose();
    void selectIcon();
    void transmitReport();
    void createPositionReport();
    void plotStation(QString callsign, char symbolTable, char symbolCode, float lat, float lon);
    void clearStation(QString callsign);
    void configureConnections();
    void aboutUs();
};

#endif // MAINWINDOW_H
